import { PetNewBaseView } from "./PetNewBaseView";
import { PetSpecialSkillItem } from "./skill/PetSpecialSkillItem";
import { PetSkillUpgradeChangePanel } from "./PetSkillUpgradeChangePanel";
import { GameController } from "../../mvc/GameController";
import { ILayer } from "../../../mvc/interfaces/ILayer";
import { AIManager } from "../../scene/ai/AIManager";
import { AIType } from "../../scene/ai/AIType";
import { DisplayUtil } from "../../../common/DisplayUtil";
import { DataEvent } from "../../events/DataEvent";
import { PetSkillUpgradeOperateVo } from "./vo/PetSkillUpgradeOperateVo";
import { Cache } from "../../cache/Cache";
import { ItemsUtil } from "../shortcuts/item/ItemsUtil";
import { Dispatcher } from "../../../mvc/core/Dispatcher";
import { EventName } from "../../mvc/EventName";
import { MsgManager } from "../../manager/MsgManager";
import { Language } from "../../../../extend/language/Language";
import { BuyCoinWindow } from "../common/BuyCoinWindow";
import { Alert } from "../../../../com/mui/controls/Alert";
import { SPetSpecialSkill } from "../../../../Message/Game/SPetSpecialSkill";
import { SkillConfig } from "../../resource/SkillConfig";
import { FilterConst } from "../../../component/gconst/FilterConst";
import { PetSpecialSkillConfig } from "../../resource/PetSpecialSkillConfig";
import { AttriAddEffect } from "../effect/AttriAddEffect";
import { ObjCreate } from "../common/ObjCreate";
import { ImagesConst } from "../../resource/ImagesConst";
import { GlobalClass } from "../../../../com/mui/core/GlobalClass";
import { SPetSpecialSkillInfo } from "../../../../Message/Game/SPetSpecialSkillInfo";
import { SPetInfo } from "../../../../Message/Game/SPetInfo";
import { ECategory } from "../../../../Message/Public/ECategory";
import { EProp } from "../../../../Message/Public/EProp";
import { SMoney } from "../../../../Message/Game/SMoney";
import { GImageBitmap } from "../../../../com/mui/controls/GImageBitmap";
import { GlobalStyle } from "../../../common/global/GlobalStyle";
import { FontUtil } from "../../../common/font/FontUtil";
import { GTextFormat } from "../../../common/GTextFormat";
import { BgItem } from "../common/BgItem";
import { ItemConfig } from "../../resource/ItemConfig";
import { PetUtil } from "./info/PetUtil";
import { ItemInfo } from "../../resource/info/ItemInfo";
import { CurUsePetSpecialSkillItem } from "./skill/CurUsePetSpecialSkillItem";
import { ENpcEffect } from "../../../../Message/Public/ENpcEffect";
import { FlyFootBmp } from "../mapUI/flyFoot/FlyFootBmp";
import { LoaderHelp } from "../../../common/display/LoaderHelp";
import { ResFileConst } from "../../resource/ResFileConst";
import { EffectManager } from "../../manager/EffectManager";
import { GButton } from "../../../../com/mui/controls/GButton";
import { GBitmap } from "../../../../com/mui/controls/GBitmap";
import { GTextFiled } from "../../../../com/mui/controls/GTextFiled";
import { GNumericStepper } from "../../../../com/mui/controls/GNumericStepper";
import { TextBox } from "../pack/TextBox";
import { TaskTargetInfo } from "../../model/TaskTargetInfo";
import { Vector } from "../../../../__AS3__/vec/Vector";
type int = number;
//class PetSkillUpgradePanel
    
    export  class PetSkillUpgradePanel extends PetNewBaseView
    {
        constructor()
        {
            super();
            this._skillItems = new Vector.<PetSpecialSkillItem>();
            this._curUseSpecialSkill = [0, 0];
            return;
        }

        /* internal  */get skillChangeView(): PetSkillUpgradeChangePanel
        {
            if (!this._skillChangeView) 
            {
                this._skillChangeView = new PetSkillUpgradeChangePanel(GameController.pet.view as ILayer);
            }
            return this._skillChangeView;
        }

        /* internal  */onExchangeLinkHandler(arg1: Object /* flash.events.TextEvent */): void
        {
            if (this._npcTarget) 
            {
                GameController.pet.view.hide();
                AIManager.onAutoPathAIControl(this._npcTarget);
            }
            return;
        }

        /* internal  */onFlyFootClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (this._npcTarget) 
            {
                GameController.pet.view.hide();
                AIManager.onAIControl(this._npcTarget, AIType.AI_Convey);
            }
            return;
        }

        /* internal  */getGrowPerBmd(arg1: int): Object /* flash.display.BitmapData */
        {
            if (!this._bmpdFeedBase) 
            {
                return new Object /* flash.display.BitmapData */(10, 10, true, 16777215);
            }
            if (arg1 > 100) 
            {
                arg1 = 100;
            }
            var loc1=arg1 * this._bmpdFeedBase.height / 100;
            if (loc1 <= 0) 
            {
                return new Object /* flash.display.BitmapData */(10, 10, true, 16777215);
            }
            var loc2=new Object /* flash.display.BitmapData */(this._bmpdFeedBase.width, loc1, true, 16777215);
            loc2.draw(this._bmpdFeedBase, new Object /* flash.geom.Matrix */(1, 0, 0, 1, 0, loc1 - this._bmpdFeedBase.height), null, null, new Object /* flash.geom.Rectangle */(0, 0, this._bmpdFeedBase.width, loc1));
            return loc2;
        }

        /* internal  */getGrowPer(arg1: int, arg2: int): int
        {
            if (arg2 == 0) 
            {
                return 0;
            }
            return Math.floor(arg1 * 100 / arg2);
        }

        /* internal  */set curShenTongTxt(arg1: int)
        {
            if (arg1 != 0) 
            {
                this._firstSkillBtn.styleName = "Button";
                this._secondSkillBtn.styleName = "ArenaRedBtn";
                this._firstSkillBtn.height = 27;
                this._secondSkillBtn.height = 25;
                DisplayUtil.removeMe(this._firstSkillTxt);
                this.addChild(this._secondSkillTxt);
            }
            else 
            {
                this._firstSkillBtn.styleName = "ArenaRedBtn";
                this._secondSkillBtn.styleName = "Button";
                this._firstSkillBtn.height = 25;
                this._secondSkillBtn.height = 27;
                DisplayUtil.removeMe(this._secondSkillTxt);
                this.addChild(this._firstSkillTxt);
            }
            return;
        }

        /* internal  */onClickSkillBtnHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (this._skillInfos && this.isNoBorrow) 
            {
                if (arg1.target.name == "firstSkillBtn" && this._petInfo.reinLevel >= 1) 
                {
                    this._curSelectIndex = 0;
                    this.curShenTongTxt = this._curSelectIndex;
                    this.data = this._skillInfos[this._curSelectIndex];
                }
                else if (arg1.target.name == "secondSkillBtn" && this._petInfo.reinLevel >= 2) 
                {
                    this._curSelectIndex = 1;
                    this.curShenTongTxt = this._curSelectIndex;
                    this.data = this._skillInfos[this._curSelectIndex];
                }
            }
            return;
        }

        /* internal  */get isNoBorrow(): Boolean
        {
            return this._petInfo && this._petInfo.isBorrow == false;
        }

        /* internal  */onPetSkillStudyHandler(arg1: DataEvent): void
        {
            var loc1=0;
            var loc2=null;
            var loc3=null;
            if (this.isNoBorrow) 
            {
                loc1 = arg1.data as int;
                loc2 = new PetSkillUpgradeOperateVo();
                loc3 = Cache.instance.pack.backPackCache.getUidByJudgeAndEffect(ItemsUtil.isSpecialPetSkillBook, loc1);
                loc2.petUid = this._petInfo.uid;
                loc2.uid = loc3[0] as string;
                loc2.index = this._curSelectIndex + 1;
                loc2.skillId = loc1;
                Dispatcher.dispatchEvent(new DataEvent(EventName.PetSkillActivate, loc2));
            }
            return;
        }

        /* internal  */onUpgadeHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (!this.isNoBorrow) 
            {
                return;
            }
            if (this._hasFull) 
            {
                MsgManager.showRollTipsMsg(Language.getString(28068));
                return;
            }
            if (Cache.instance.role.money.coin + Cache.instance.role.money.coinBind < this._upgadeTimes.value * 5000) 
            {
                BuyCoinWindow.instance.show();
                return;
            }
            var loc1=new PetSkillUpgradeOperateVo();
            loc1.petUid = this._petInfo.uid;
            loc1.index = this._curSelectIndex + 1;
            loc1.materialNum = this._upgadeTimes.value;
            Dispatcher.dispatchEvent(new DataEvent(EventName.PetSkillUpgrade, loc1));
            return;
        }

        /* internal  */onPetSpecialSkillPutOnOrPutDownHandler(arg1: DataEvent): void
        {
            this.onUseSkillHandler();
            return;
        }

        /* internal  */onPetSpecialSkillChangeViewShowHandler(arg1: DataEvent): void
        {
            if (this.isNoBorrow) 
            {
                this.skillChangeView.show(730, 56);
                this.skillChangeView.petInfo = this._petInfo;
                this.skillChangeView.index = arg1.data as int;
                this.skillChangeView.curUseSpecialSkill = this._curUseSpecialSkill;
                this.skillChangeView.skillInfos = this._skillInfos;
            }
            return;
        }

        /* internal  */onUseSkillHandler(arg1: Object /* flash.events.MouseEvent */=null): void
        {
            var e: Object /* flash.events.MouseEvent */=null;
            var item: PetSpecialSkillItem;
            var onClickHandler: Function;
            var vo: PetSkillUpgradeOperateVo;

            var loc1;
            item = null;
            onClickHandler = null;
            vo = null;
            e = arg1;
            onClickHandler = (arg1: int): void
            {
                if (arg1 == Alert.OK) 
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.PetSkillUse, vo));
                    item.isSelect = false;
                    item.type = item.type;
                    onPetSpecialSkillItemSelectHandler();
                }
                return;
            }
            if (!this.isNoBorrow) 
            {
                return;
            }
            var loc2=0;
            var loc3=this._skillItems;
            for(item of loc3) 
            {
                if (!item.isSelect) 
                {
                    continue;
                }
                if (item.type != PetSpecialSkillItem.HAS_STUDY) 
                {
                    continue;
                }
                vo = new PetSkillUpgradeOperateVo();
                vo.petUid = this._petInfo.uid;
                vo.index = this._curSelectIndex + 1;
                vo.skillId = this._curUseSpecialSkill[this._curSelectIndex] != this.getCurLevelId(item.skill.skillId) ? this.getCurLevelId(item.skill.skillId) : 0;
                if (!(vo.skillId == 0) && SPetSpecialSkill(this._skillInfos[this._curSelectIndex]).hasUse) 
                {
                    Alert.show(Language.getString(28080), null, Alert.OK | Alert.CANCEL, null, onClickHandler);
                    return;
                }
                if (SPetSpecialSkill(this._skillInfos[this._curSelectIndex]).hasUse) 
                {
                    Alert.show(Language.getString(28086), null, Alert.OK | Alert.CANCEL, null, onClickHandler);
                    return;
                }
                item.isSelect = false;
                item.type = item.type;
                Dispatcher.dispatchEvent(new DataEvent(EventName.PetSkillUse, vo));
                this.onPetSpecialSkillItemSelectHandler();
                break;
            }
            return;
        }

        /* internal  */onPetSpecialSkillItemSelectHandler(arg1: DataEvent=null): void
        {
            var loc1=0;
            var loc2=0;
            if (this.isNoBorrow && arg1) 
            {
                loc1 = arg1.data.skillId as int;
                loc2 = arg1.data.skillType as int;
                if (loc2 == PetSpecialSkillItem.NO_STUDY) 
                {
                    MsgManager.showRollTipsMsg(Language.getString(28083));
                }
                this._useSkillBtn.label = this._curUseSpecialSkill[this._curSelectIndex] != this.getCurLevelId(loc1) ? Language.getString(28066) : Language.getString(28078);
            }
            else 
            {
                this._useSkillBtn.label = Language.getString(28066);
            }
            return;
        }

        /* internal  */getCurLevelId(arg1: int): int
        {
            if (this._petSpecialSkill.level == 0) 
            {
                return arg1;
            }
            return (arg1 + this._petSpecialSkill.level - 1);
        }

        /* internal  */set curUseSpecialSkillList(arg1: Array<any>)
        {
            this._curUseSpecialSkillItemOne.skill = SkillConfig.instance.getInfoByName(arg1[0]);
            this._curUseSpecialSkillItemTwo.skill = SkillConfig.instance.getInfoByName(arg1[1]);
            return;
        }

        /* internal  */onSpendTxtChangeHandler(arg1: Object /* flash.events.Event */): void
        {
            if (this._upgadeTimes.value > this._upgadeTimes.maximum) 
            {
                this._upgadeTimes.value = this._upgadeTimes.maximum;
            }
            this._spendTxt.textField.text = String(this._upgadeTimes.value * 2000);
            return;
        }

        /* internal  */set bmpFeedData(arg1: int)
        {
            this._tfFeedPer.text = arg1 + "%";
            this._bmpFeed.bitmapData = this.getGrowPerBmd(arg1);
            this._bmpFeed.y = 53 + 118 - this._bmpFeed.bitmapData.height;
            return;
        }

        /* internal  */set material(arg1: int)
        {
            this._upgadeTimes.maximum = arg1 > 99 ? 99 : arg1;
            this._material.setItemCode(14162001, arg1);
            this._material.filters = arg1 > 0 ? [] : [FilterConst.colorFilter];
            return;
        }

        /* internal  */set data(arg1: SPetSpecialSkill)
        {
            var loc1=0;
            var loc2=0;
            var loc3=0;
            var loc4=null;
            var loc5=null;
            var loc6=0;
            var loc7=0;
            this._petSpecialSkill = arg1;
            if (arg1) 
            {
                loc2 = PetSpecialSkillConfig.instance.getExperienceByLevel(arg1.level);
                if ((loc3 = PetSpecialSkillConfig.instance.getExperienceByLevel(arg1.level + 1) - loc2) > 0 || loc3 <= 0 && arg1.expirence < loc2) 
                {
                    this._hasFull = false;
                    loc1 = arg1.expirence - loc2;
                    loc6 = this.getGrowPer(loc1, loc3);
                    this._progressTxt.text = loc1 + "/" + loc3;
                    this.bmpFeedData = loc6;
                }
                else if (loc3 <= 0 && arg1.expirence >= loc2) 
                {
                    this._hasFull = true;
                    this._progressTxt.text = "";
                    this.bmpFeedData = 0;
                }
                this._lvTxt.text = "Lv." + arg1.level;
                loc4 = Cache.instance.pack.backPackCache.getSpecialPetSkillBookList(ItemsUtil.isSpecialPetSkillBook);
                var loc8=0;
                var loc9=this._skillItems;
                for(loc5 of loc9) 
                {
                    if ((loc7 = arg1.skills.indexOf(this.getCurLevelId(loc5.skill.skillId))) == -1) 
                    {
                        if (loc4.indexOf(loc5.skill.skillId) == -1) 
                        {
                            loc5.isUseing = false;
                            loc5.type = PetSpecialSkillItem.NO_STUDY;
                        }
                        else 
                        {
                            loc5.isUseing = false;
                            loc5.type = PetSpecialSkillItem.CAN_STUDY;
                        }
                    }
                    else 
                    {
                        loc5.isUseing = this._curUseSpecialSkill[this._curSelectIndex] == this.getCurLevelId(loc5.skill.skillId);
                        loc5.type = PetSpecialSkillItem.HAS_STUDY;
                    }
                    loc5.skillLevel = arg1.level;
                }
                if (this._skillChangeView && this._skillChangeView.parent) 
                {
                    this.skillChangeView.petInfo = this._petInfo;
                    this.skillChangeView.curUseSpecialSkill = this._curUseSpecialSkill;
                    this.skillChangeView.skillInfos = this._skillInfos;
                }
            }
            return;
        }

        public playCriEffect(arg1: int, arg2: Boolean): void
        {
            var loc1=new Object /* flash.geom.Point */(this._bmpFeed.x + this._bmpFeed.width / 2, 118);
            var loc2=localToGlobal(loc1);
            AttriAddEffect.attriAdd(arg1, loc2.x, loc2.y, arg2);
            return;
        }

        /* internal  */onLoadResHandler(): void
        {
            ObjCreate.createGBitmap(ImagesConst.PetSkillUpgradeSpendTxt, 102, 198, this);
            ObjCreate.createGBitmap(ImagesConst.PetSkillUpgradeTimeTxt, 233, 198, this);
            ObjCreate.createGBitmap(ImagesConst.CurShenTongSkill, 12, 309, this);
            ObjCreate.createGBitmap(ImagesConst.FirstUseShenTongTxt, 406, 3, this);
            ObjCreate.createGBitmap(ImagesConst.SecondUseShenTongTxt, 406, 102, this);
            var loc1=ObjCreate.createGBitmap(ImagesConst.PetSkillUpgradeInfoBg, 123, 45, this._sp);
            this._sp.swapChildren(this._bmpFeed, loc1);
            this._firstSkillTxt.bitmapData = GlobalClass.getBitmapData(ImagesConst.FirstShenTongTxt);
            this._secondSkillTxt.bitmapData = GlobalClass.getBitmapData(ImagesConst.SecondShenTongTxt);
            this._growTxt.bitmapData = GlobalClass.getBitmapData(ImagesConst.PetSkillUpgradeRuneFeedGrow);
            this._bmpdFeedBase = GlobalClass.getBitmapData(ImagesConst.PetSkillUpgradeInfo);
            if (this._skillInfos) 
            {
                this.data = this._skillInfos[this._curSelectIndex];
            }
            return;
        }

        public petSpecialSkillInfo(arg1: SPetSpecialSkillInfo): void
        {
            this._skillInfos = arg1.skillInfos;
            this.data = this._skillInfos[this._curSelectIndex];
            return;
        }

        public /* override */ updateByPetInfo(arg1: SPetInfo): void
        {
            var loc1=null;
            var loc2=0;
            if (this._petInfo && !(this._petInfo.uid == arg1.uid)) 
            {
                this.clear();
            }
            if (arg1.reinLevel > 0) 
            {
                this._petInfo = arg1;
                this._curUseSpecialSkill = [0, 0];
                var loc3=0;
                var loc4=this._petInfo.skills;
                for(loc1 of loc4) 
                {
                    if (loc1.pos == 51) 
                    {
                        this._curUseSpecialSkill[0] = loc1.skillId;
                        continue;
                    }
                    if (loc1.pos != 52) 
                    {
                        continue;
                    }
                    this._curUseSpecialSkill[1] = loc1.skillId;
                }
                this._firstSkillBtn.filters = this._petInfo.reinLevel >= 1 ? [] : [FilterConst.colorFilter2];
                this._firstSkillBtn.toolTipData = this._petInfo.reinLevel >= 1 ? "" : Language.getString(28075);
                this._secondSkillBtn.filters = this._petInfo.reinLevel >= 2 ? [] : [FilterConst.colorFilter2];
                this._secondSkillBtn.toolTipData = this._petInfo.reinLevel >= 2 ? "" : Language.getString(28076);
                this.curShenTongTxt = this._curSelectIndex;
                this.curUseSpecialSkillList = this._curUseSpecialSkill;
                Dispatcher.dispatchEvent(new DataEvent(EventName.PetSpecailSkillInfoGet, arg1.uid));
            }
            else 
            {
                if (this._index > 0) 
                {
                    MsgManager.showRollTipsMsg(Language.getString(28077));
                    this.clear();
                }
                this._firstSkillBtn.filters = [FilterConst.colorFilter2];
                this._firstSkillBtn.toolTipData = Language.getString(28075);
                this._secondSkillBtn.filters = [FilterConst.colorFilter2];
                this._secondSkillBtn.toolTipData = Language.getString(28076);
            }
            if (this._index == 0) 
            {
                loc2 = Cache.instance.pack.backPackCache.getItemCountByCategoryAndType(ECategory._ECategoryProp, EProp._EPropPetSkillFeed);
                this.material = loc2;
            }
            this._upgadeBtn.enabled = this.isNoBorrow;
            loc4 = ((loc3 = this)._index + 1);
            loc3._index = loc4;
            return;
        }

        protected /* override */ onMoneyUpdateHandler(arg1: SMoney=null): void
        {
            return;
        }

        public /* override */ update(arg1: Object, ... rest): void
        {
            super.update(arg1, rest);
            this._index = 0;
            this.clear();
            return;
        }

        protected /* override */ onPackChangeHandler(arg1: Object=null): void
        {
            if (this._skillInfos && this._skillInfos.length >= 2) 
            {
                this.data = this._skillInfos[this._curSelectIndex];
            }
            var loc1=Cache.instance.pack.backPackCache.getItemCountByCategoryAndType(ECategory._ECategoryProp, EProp._EPropPetSkillFeed);
            this.material = loc1;
            return;
        }

        protected /* override */ createDisposedChildrenImpl(): void
        {
            var loc7=null;
            var loc13=null;
            super.createDisposedChildrenImpl();
            ObjCreate.createFlowerBg(0, 0, 388, 303, this);
            ObjCreate.createBg(5, 5, 378, 218, this);
            ObjCreate.createBg(0, 305, 388, 95, this);
            ObjCreate.createBg(390, 0, 193, 400, this);
            ObjCreate.createBg(0, 306, 160, 25, this, ImagesConst.TileBg);
            ObjCreate.createBg(390, 0, 160, 25, this, ImagesConst.TileBg);
            ObjCreate.createBg(390, 100, 160, 25, this, ImagesConst.TileBg);
            var loc1=new GImageBitmap(ImagesConst.PetSkillUpgradeBg, 8, 8);
            this.addChild(loc1);
            this._sp = new Object /* flash.display.Sprite */();
            this.addChild(this._sp);
            this._bmpFeed = new Object /* flash.display.Bitmap */();
            ObjCreate.setObjAttri(this._bmpFeed, 136, 53, -1, -1, this._sp);
            var loc2=GlobalStyle.textFormatGreen;
            loc2.size = 18;
            loc2.font = FontUtil.xingkaiName;
            loc2.align = flash.text.TextFormatAlign.CENTER;
            this._tfFeedPer = ObjCreate.createTextField("0%", 169, 140, 60, 20, this, loc2);
            this._lvTxt = ObjCreate.createTextField("", 225, 19, 60, 20, this, loc2);
            var loc3=new GTextFormat(FontUtil.songtiName, 12, 11661311, null, null, null, null, null, flash.text.TextFormatAlign.CENTER);
            this._progressTxt = ObjCreate.createGTextField("", 150, 125, 95, 20, this, loc3);
            this._material = new BgItem();
            ObjCreate.setObjAttri(this._material, 176, 182, -1, -1, this);
            this._firstSkillBtn = ObjCreate.createGButton(Language.getString(28062), 20, 15, 65, 27, this);
            this._firstSkillBtn.name = "firstSkillBtn";
            this._firstSkillBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onClickSkillBtnHandler);
            this._secondSkillBtn = ObjCreate.createGButton(Language.getString(28063), 20, 45, 65, 27, this);
            this._secondSkillBtn.name = "secondSkillBtn";
            this._secondSkillBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onClickSkillBtnHandler);
            this._firstSkillTxt = ObjCreate.createGBitmap("", 164, 18);
            this._secondSkillTxt = ObjCreate.createGBitmap("", 164, 18);
            this._growTxt = ObjCreate.createGBitmap("", 166, 95, this);
            var loc4;
            (loc4 = ObjCreate.createBg(70, 195, 120, 20, this, ImagesConst.FightingStrgBg)).alpha = 0.7;
            var loc5;
            (loc5 = ObjCreate.createBg(205, 195, 120, 20, this, ImagesConst.FightingStrgBg)).alpha = 0.7;
            this._upgadeTimes = ObjCreate.createGNumericStepper(296, 194, 49, 22, this);
            this._upgadeTimes.needDispatchEvent = true;
            this._upgadeTimes.addEventListener(flash.events.Event.CHANGE, this.onSpendTxtChangeHandler);
            this._upgadeBtn = ObjCreate.createGButton(Language.getString(28064), 154, 245, 82, 28, this, "ButtonRed");
            this._upgadeBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onUpgadeHandler);
            ObjCreate.createGTextField(Language.getString(27666), 260, 252, 70, 20, this, GlobalStyle.textFormat2);
            this._spendTxt = ObjCreate.createTextBox("2000", 293, 251, 70, 20, this, GlobalStyle.textFormatWhite);
            ObjCreate.createBitmap(ImagesConst.Tongqian, 344, 252, this);
            ObjCreate.createFireTip(Language.getString(28065), 50, 275, this, true);
            this._useSkillBtn = ObjCreate.createGButton(Language.getString(28066), 321, 310, 50, 22, this);
            this._useSkillBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onUseSkillHandler);
            var loc6;
            var loc8=(loc6 = ItemConfig.instance.getItemsByJudge(PetUtil.isSpecialPetSkillBookDraw)).length;
            var loc9=0;
            while (loc9 < loc8) 
            {
                loc7 = loc6[loc9] as ItemInfo;
                (loc13 = new PetSpecialSkillItem()).skill = SkillConfig.instance.getInfoByName(loc7.item.effect);
                loc13.skillLevel = 0;
                loc13.type = PetSpecialSkillItem.NO_STUDY;
                ObjCreate.setObjAttri(loc13, 20 + 45 * loc9, 340, 32, 32, this);
                this._skillItems.push(loc13);
                ++loc9;
            }
            ObjCreate.createGTextField(Language.getString(28094), 140, 310, 180, 20, this, null, true);
            ObjCreate.createBg(397, 31, 180, 60, this, ImagesConst.DisabledBg);
            ObjCreate.createBg(397, 131, 180, 60, this, ImagesConst.DisabledBg);
            this._curUseSpecialSkillItemOne = new CurUsePetSpecialSkillItem(0);
            ObjCreate.setObjAttri(this._curUseSpecialSkillItemOne, 400, 30, -1, -1, this);
            this._curUseSpecialSkillItemTwo = new CurUsePetSpecialSkillItem(1);
            ObjCreate.setObjAttri(this._curUseSpecialSkillItemTwo, 400, 130, -1, -1, this);
            var loc10;
            (loc10 = ObjCreate.createGTextField(Language.getString(28074), 400, 235, 175, 160, this, GlobalStyle.setTextFormatLeading(GlobalStyle.textFormat1, 5), true)).multiline = true;
            loc10.wordWrap = true;
            this._npcTarget = Cache.instance.scene.getNpcByEffect(ENpcEffect._ENpcEffectRobIslandExchange);
            var loc11=new FlyFootBmp();
            ObjCreate.setObjAttri(loc11, 552, 204, -1, -1, this);
            loc11.addEventListener(flash.events.MouseEvent.CLICK, this.onFlyFootClickHandler);
            var loc12;
            (loc12 = ObjCreate.createTextField(Language.getString(28087), 500, 203, 55, 20, this, null, true)).addEventListener(flash.events.TextEvent.LINK, this.onExchangeLinkHandler);
            Dispatcher.addEventListener(EventName.PetSkillStudy, this.onPetSkillStudyHandler);
            Dispatcher.addEventListener(EventName.PetSpecialSkillItemSelect, this.onPetSpecialSkillItemSelectHandler);
            Dispatcher.addEventListener(EventName.PetSpecialSkillPutOnOrPutDown, this.onPetSpecialSkillPutOnOrPutDownHandler);
            Dispatcher.addEventListener(EventName.PetSpecialSkillChangeViewShow, this.onPetSpecialSkillChangeViewShowHandler);
            LoaderHelp.addResCallBack(ResFileConst.PetSkillUpgrade, this.onLoadResHandler);
            return;
        }

        /* internal  */clear(): void
        {
            var loc1=null;
            var loc2=0;
            var loc3=this._skillItems;
            for(loc1 of loc3) 
            {
                loc1.isSelect = false;
                loc1.isUseing = false;
                loc1.type = PetSpecialSkillItem.NO_STUDY;
                loc1.skillLevel = 0;
            }
            if (this._skillChangeView) 
            {
                this._skillChangeView.hide();
                this._skillChangeView = null;
            }
            this._hasFull = false;
            this._upgadeTimes.value = 1;
            this._spendTxt.textField.text = "2000";
            this._tfFeedPer.text = "";
            this._progressTxt.text = "";
            this._curSelectIndex = 0;
            this._progressTxt.text = "";
            this._lvTxt.text = "";
            this._skillInfos = null;
            this._petInfo = null;
            this._petSpecialSkill = null;
            this.bmpFeedData = 0;
            this._curUseSpecialSkill = [0, 0];
            this.onPetSpecialSkillItemSelectHandler();
            this.curUseSpecialSkillList = this._curUseSpecialSkill;
            DisplayUtil.removeMe(this._firstSkillTxt);
            DisplayUtil.removeMe(this._secondSkillTxt);
            EffectManager.glowFilterUnReg(this._firstSkillBtn);
            EffectManager.glowFilterUnReg(this._secondSkillBtn);
            return;
        }

        /* internal */ /* var */_sp: Object /* flash.display.Sprite */;

        /* internal */ /* var */_firstSkillBtn: GButton;

        /* internal */ /* var */_secondSkillBtn: GButton;

        /* internal */ /* var */_firstSkillTxt: GBitmap;

        /* internal */ /* var */_secondSkillTxt: GBitmap;

        /* internal */ /* var */_growTxt: GBitmap;

        /* internal */ /* var */_lvTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_progressTxt: GTextFiled;

        /* internal */ /* var */_material: BgItem;

        /* internal */ /* var */_upgadeTimes: GNumericStepper;

        /* internal */ /* var */_spendTxt: TextBox;

        /* internal */ /* var */_upgadeBtn: GButton;

        /* internal */ /* var */_useSkillBtn: GButton;

        /* internal */ /* var */_curUseSpecialSkillItemOne: CurUsePetSpecialSkillItem;

        /* internal */ /* var */_curUseSpecialSkillItemTwo: CurUsePetSpecialSkillItem;

        /* internal */ /* var */_skillItems: Vector.<PetSpecialSkillItem>;

        /* internal */ /* var */_skillInfos: Array<any>;

        /* internal */ /* var */_curSelectIndex: int=0;

        /* internal */ /* var */_petInfo: SPetInfo;

        /* internal */ /* var */_petSpecialSkill: SPetSpecialSkill;

        /* internal */ /* var */_bmpFeed: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_bmpdFeedBase: Object /* flash.display.BitmapData */;

        /* internal */ /* var */_hasFull: Boolean;

        /* internal */ /* var */_npcTarget: TaskTargetInfo;

        /* internal */ /* var */_skillChangeView: PetSkillUpgradeChangePanel;

        /* internal */ /* var */_index: int;

        /* internal */ /* var */_tfFeedPer: Object /* flash.text.TextField */;

        /* internal */ /* var */_curUseSpecialSkill: Array<any>;
    }
